#region

using Gurock.SmartInspect;
using Microsoft.Practices.Unity.InterceptionExtension;

#endregion

namespace SmartInspect.Extensions.Unity
{
    public class SiSessionHandler : SiBaseHandler
    {
        private Session _session;
        public string SessionName { private get; set; }
        public SessionPolicy SessionPolicy { private get; set; }

        public override IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
        {
            object inputTarget = input.Target;
            _session = inputTarget.GetLogger();
            StartCallHandlerInvoke(input, _session);
            IMethodReturn ret = getNext().Invoke(input, getNext);
            StopCallHandlerInvoke(input, _session);
            return ret;
        }
    }
}